<?php
  class Controller{
    protected $view;
    protected $params;
    protected $action;

    public function set_params($params){
      $this->params = $params;
    }
    public function set_userId($id){
      $this->user_id = $id;
    }
    public function set_view($view){
      $this->view = $view;
    }
    public function set_action($actionName){
      if(method_exists($this, $actionName.'Action')){
        $this->action = $actionName.'Action';
      }else{
        $this->action = 'ErrorAction';
      }
    }
    public function ErrorAction(){
      $this->view->set_folder('Error');
      $this->view->set_tpl('Error');
    }
    public function run(){
      $action = $this->action;
      $this->$action();
      //TODO Может быть стоит запихнуть в класс View?
      $um = new UserMapper();
      $this->view->set_user($um->getCurrentUser());
      // $this->view->set_user(UserMapper::getCurrentUser());
    }
  }
?>